package com.lh.tams.dao;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;
import com.lh.tams.dao.base.HibernateBaseDao;
import com.lh.tams.domain.Countryinfo;
import com.lh.tams.util.DataGridModel;
import com.lh.tams.util.Page;

/**
 * 城市Dao
 * @author hc24
 *
 */
@Repository
public class CountryInfoDao extends HibernateBaseDao {
	
	/**
	 * 根据参数查询城市信息
	 * @param dgm
	 * @param country
	 * @return
	 */
	public Page query(DataGridModel dgm,Countryinfo country){
		List<Object> args=new ArrayList<Object>();
		StringBuilder hql=new StringBuilder();
		hql.append("from Countryinfo c where 1=1");
		if(country.getCountryCm()!=null&&!"".equals(country.getCountryCm())){
			hql.append(" and c.countryCm like ?");
			args.add("%"+country.getCountryCm()+"%");
		}
		return super.queryForList(hql.toString(), args.toArray(), dgm.getPage(), dgm.getRows());
	}
	
}
